import HttpService from '../../app/services/httpService.js';

class ServiceService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	ServiceScoresmsUrl: this.URL + '/service/scoresms?course_id=',
            ServiceCoursecertUrl: this.URL + '/service/coursecert?course_id=',
            ServiceUploadcertUrl: this.URL + '/service/uploadcert?course_id=',
            ServiceSmsNumUrl: this.URL + '/service/companysmscount?company_id=',
            ServiceSmsLogUrl: this.URL + '/service/companysmslog?company_id=',
            ServiceRunnerListUrl: this.URL + '/trace/latest?race_id=',
            ServiceSearchRunnerInfoUrl: this.URL + '/trace/lists?race_id=',
            ServiceSmsListUrl: this.URL + '/sms/lists?race_id=',
            ServiceSmsTargetsUrl: this.URL + '/sms/targets?race_id=',
            ServiceSmsPreviewUrl: this.URL + '/sms/preview?race_id=',
            ServiceSmsCreateUrl: this.URL + '/sms/create?race_id=',
            ServiceSmsUpdateUrl: this.URL + '/sms/update?sid=',
            ServiceSmsDetailUrl: this.URL + '/sms/detail?sid=',
            ServiceSmsDelUrl: this.URL + '/sms/del?sid=',
            ServiceSmsTestUrl: this.URL + '/sms/test?race_id=',
            ServiceTraceSearchRunnerUrl: this.URL + '/trace/search?race_id=',
            ServiceTraceListsUrl: this.URL + '/trace/lists?course_id=',
        }

    }

    /* 短信预览 */
    postServiceScoresmsPreview(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceScoresmsUrl, params, headers, search + '&op=preview');
    }

    /* 短信保存 */
    postServiceScoresmsSave(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceScoresmsUrl, params, headers, search + '&op=save');
    }

    /* 短信详情 */
    getServiceScoresms(headers, search) {
        return this.getRequest(this.OBJ.ServiceScoresmsUrl, headers, search + '&op=get');
    }

    /* 短信测试发送 */
    postServiceScoresmsTest(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceScoresmsUrl, params, headers, search + '&op=test');
    }

    /* 获取成绩证书接口 */
    postServiceCoursecert(headers, search) {
        return this.getRequest(this.OBJ.ServiceCoursecertUrl, headers, search + '&op=get');
    }

    /* 保存成绩编辑信息证书接口 */
    postServiceCoursecertSave(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceCoursecertUrl, params, headers, search + '&op=save');
    }

    /* 删除证书接口 */
    postServiceCoursecertDel(headers, search) {
        return this.getRequest(this.OBJ.ServiceCoursecertUrl, headers, search + '&op=del');
    }

    /* 保存证书或更改证书 */
    postServiceUploadcert(params, headers, search) {
        return this.postMultipart(this.OBJ.ServiceUploadcertUrl, params, headers, search + '&op=post');
    }

    /* 获取短信剩余条数接口 */
    getServiceSmsNum(headers, search) {
        return this.getRequest(this.OBJ.ServiceSmsNumUrl, headers, search);
    }

    /* 获取短信日志接口 */
    getServiceSmsLog(headers, search) {
        return this.getRequest(this.OBJ.ServiceSmsLogUrl, headers, search);
    }

    /* 获取最新十条选手动态数据 */
    getServiceRescueRunnerList(headers, search) {
        return this.getRequest(this.OBJ.ServiceRunnerListUrl, headers, search);
    }

    /* 搜索获取选手的路线信息 */
    getServiceRescueSearchRunnerInfo(headers, search) {
        return this.getRequest(this.OBJ.ServiceSearchRunnerInfoUrl, headers, search);
    }

    /** 短信群发：获取任务列表 */
    getServiceSmsList(headers, search) {
        return this.getRequest(this.OBJ.ServiceSmsListUrl, headers, search);
    }

    /** 短信群发：获取目标人数 */
    getServiceSmsTargets(headers, search) {
        return this.getRequest(this.OBJ.ServiceSmsTargetsUrl, headers, search);
    }

    /** 短信群发：预览短信 */
    postServiceSmsPreview(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceSmsPreviewUrl, params, headers, search);
    }

    /** 短信群发：创建短信任务 */
    postServiceSmsCreate(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceSmsCreateUrl, params, headers, search);
    }

    /** 短信群发：编辑短信任务 */
    postServiceSmsUpdate(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceSmsUpdateUrl, params, headers, search);
    }

    /** 短信群发：获取任务详情 */
    getServiceSmsDetail(headers, search) {
        return this.getRequest(this.OBJ.ServiceSmsDetailUrl, headers, search);
    }

    /** 短信群发：取消任务 */
    getServiceSmsDel(headers, search) {
        return this.getRequest(this.OBJ.ServiceSmsDelUrl, headers, search);
    }

    /** 短信群发：短信测试 */
    postServiceSmsTest(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceSmsTestUrl, params, headers, search);
    }

    /** 赛事救援：获取选手详情 */
    postServiceTraceSearchRunner(params, headers, search) {
        return this.postRequest(this.OBJ.ServiceTraceSearchRunnerUrl, params, headers, search);
    }

    /** 赛事救援：获取科目各个cp点通过率及时间 */
    getServiceTraceLists(headers, search) {
        return this.getRequest(this.OBJ.ServiceTraceListsUrl, headers, search);
    }
}

export default ServiceService;